# encoding=utf-8
# author:梁子龙
from pydantic import BaseModel, Field
from typing import Union
from api.schemas import InDBMixin


class BaseUserSchema(BaseModel):
    """

    """
    username: str = Field(description="用户名", default=None)
    phone: Union[str, None] = Field(description="用户名", default=None)
    email: Union[str, None] = Field(description="用户名", default=None)
    real_name: Union[str, None] = Field(description="用户名", default=None)
    icon: Union[str, None] = Field(description="用户名", default=None)


class CreateUserSchema(BaseUserSchema):
    password: Union[str, None] = Field(description="密码", default=None)


class UserSchema(BaseUserSchema, InDBMixin):
    """
    查询用户数据
    """
    pass


class UserLoginSchema(BaseModel):
    """
    查询用户数据
    """
    username: str = Field(description="用户名")
    password: str = Field(description="密码")


class UserLoginRepSchema(UserSchema):
    """
    查询用户数据
    """
    token: str
